import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)


const state = {
    //http://suzuki-dev-finance.haimaiche.net:8999
	url: 'http://localhost:8081',
    token: '',
    staffId: 123,
    staffName: '',
    menuList:[],
    bank: [],
    sex: [
        { label: '男', value: 0 },
        { label: '女', value: 1 },
        { label: '其它', value: 1 },
    ],
    marryStatus: [
        { label: '未婚', value: 0 },
        { label: '已婚', value: 1 },
    ],
    serviceSource: [
        { label: '4s店销售源', value: 0 },
        { label: 'xx店销售源', value: 1 },
    ],
    education: [
        { label: '本科', value: 0 },
        { label: '研究生', value: 1 },
    ],
    unitType: [
        { label: '事业单位', value: 0 },
        { label: '其它', value: 1 },
    ],
    job: [
        { label: '项目经理', value: 0 },
        { label: '其它', value: 1 },
    ],
    seniority: [
        { label: '3年', value: 0 },
        { label: '其它', value: 1 },
    ],
    creditYear: [
        { label: '3年', value: 0 },
        { label: '其它', value: 1 },
    ],
    link: [
        { label: '本人', value: 0 },
        { label: '其它', value: 1 },
    ],
    linkOther: [
        { label: '师父', value: 0 },
        { label: '其它', value: 1 },
    ],
    houseType: [
        { label: '商品房', value: 0 },
        { label: '其它', value: 1 },
    ],
    orderStatus: [
        { text: '征信结果待录入', value: '征信结果待录入' },
        { text: '征信结果已录入', value: '征信结果已录入' },
        { text: '审核中', value: '审核中' },
        { text: '已结清', value: '已结清' },
        { text: '申请通过', value: '申请通过' },
        { text: '申请不通过', value: '申请不通过' },
        { text: '申请附条件通过', value: '申请附条件通过' },
        { text: '财务已垫款', value: '财务已垫款' },
        { text: '银行已放款', value: '银行已放款' },
        { text: '作废', value: '作废' },
    ],
    approvalStatus: [
        { text: '贷款审批', value: '贷款审批' },
        { text: '通融审批', value: '通融审批' },
        { text: '修改审批', value: '修改审批' }
    ],
    carOriginType: [
        { label: '国产', value: 0 },
        { label: '其它', value: 1 },
    ],
    carBrand: [
        { label: '品牌1', value: 0 }
    ],
    seating: [
        { label: '4座', value: 0 }
    ],
    barVehicleComposition: [
        { label: '车型1', value: 0 }
    ],
    carRenewalInsurance: [
        { label: '有', value: 0 }
    ],
    serviceType: [
        { label: '业务类型1', value: 0 }
    ],
    gpsLocation: [
        { label: '位置1', index: 0 }
    ],
    isSuccess: [
        { label: '是', value: true },
        { label: '否', value: false }
    ],
    courierCompany: [
        { label: '顺丰速运', value: 0 },
        { label: '其它', value: 1 }
    ]
}

if (!state.token) {
    state.token = sessionStorage.getItem('token');
}

const $baseUrl = 'http://suzuki-dev-finance.haimaiche.net:8999';
const mutations = {
    bank(state) {
        $.ajax({
            url: $baseUrl + '/dataDict/bank',
            type: 'get',
            success: function(data) {
                if (data.code == 1001) {
                    state.bank = [];
                    $.each(data.data, function(i, val) {
                        state.bank.push({
                            text: val.name,
                            value: val.dataId
                        });
                    });

                }
            },
            error: function(data) {

            }
        });
    },
}

const actions = {}

const getters = {

}

const host='http://suzuki-dev-finance.haimaiche.net:8999'
            
export default new Vuex.Store({
    state,
    mutations,
    actions,
    getters
})